package com.lagou.controller;

import com.lagou.service.CodeDubboService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/code")
public class CodeController {
    @Autowired
    CodeDubboService codeService;

    @GetMapping("/create/{email}")
    public boolean create(@PathVariable String email){
        boolean result = codeService.create(email);
        return result;
    }

    @GetMapping("/validate/{email}/{code}")
    public Integer validate(@PathVariable String email,@PathVariable String code){
        Integer validate = codeService.validate(email, code);
        return validate;
    }

}
